-
Notifications
You must be signed in to change notification settings - Fork 1.1k
add shaded guava collections and use it #2086
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
return (ImmutableMapWithNullValues<K, V>) values; | ||
} | ||
return new ImmutableMapWithNullValues<>(values); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didnt want to put a of
helper here
ImmutableMapWithNullValues.of("k1", "v1")
ImmutableMapWithNullValues.of("k1", "v1", "k2", "v2")
@@ -66,7 +69,7 @@ private DataFetchingEnvironmentImpl(Builder builder) { | |||
this.locale = builder.locale; | |||
this.operationDefinition = builder.operationDefinition; | |||
this.document = builder.document; | |||
this.variables = builder.variables == null ? Collections.emptyMap() : builder.variables; | |||
this.variables = builder.variables == null ? ImmutableMapWithNullValues.empty() : builder.variables; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe renamed ImmutableMapWithNullValues.empty()
=to ImmutableMapWithNullValues.emptyMap()
- this would be clearer in my book and also better on static import
this.variables = builder.variables == null ? emptyMap() : builder.variables;
Quite happy to see this PR! I believe that the approach is very good overall and In JDK11 there are also immutable maps and lists with some nice goodies (e.g. smart Besides that, I would like to test this PR in our project and report some early feedback. |
graphql-java plans to be a late adopter of JDK 11 - namely because so many users are not there yet. |
…ns-guava # Conflicts: # src/main/java/graphql/schema/DataFetchingFieldSelectionSetImpl.java # src/test/groovy/graphql/schema/DataFetchingFieldSelectionSetImplTest.groovy
return instrumentation.beginField(parameters.withNewState(state)); | ||
}) | ||
.collect(toList())); | ||
return new ChainedInstrumentationContext<>(map(instrumentations, instrumentation -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the format change here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
@@ -169,7 +196,7 @@ public GraphQLObjectType getObjectType(String typeName) { | |||
} | |||
|
|||
public Map<String, GraphQLNamedType> getTypeMap() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't nee to be a copy
This is an internal change only: we are using guava Immutable collections now in a lot places for more performance and more clarity.